<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{message}}
    <cpn></cpn>  使用模板
  </div>

  <template id="cpn">
    <div>
      <h2>我是标题</h2>
    </div>
  </template>
  <script src="../js/vue.js"></script>
  <script>
    //1.注册一个全局组件
    Vue.component('cpn',{
      template: '#cpn'
    })
    const app = new Vue({
      el: '#app',
      data: {
        message: 'nihao'
      }
    })
  </script>
</body>
</html>